<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*,cn.edu.lanqiao.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/docs.min.css" rel="stylesheet">
<style type="text/css">
.tab {width =800;
	
}
</style>

</head>
<body>
	<%
		//构造foreach标签需要解析的数据
		//将数据缓存在session对象中
		//数据结构是list+Entity，表示的是查询结果是二维表结构
		List lstStu = new ArrayList();
		Student stu = new Student();
		stu.setStudent_code(100);
		stu.setStudent_name("张三");
		stu.setSex("男");
		stu.setAge(22);
		stu.setPhone("13844453388");
		stu.setAddress("天津");
		lstStu.add(stu);
		//将数据存入session缓存
		session.setAttribute("lst", lstStu);
		//清除缓存
		//session.removeAttribute("lstStu");
		//foreach

		List lstMaps = new ArrayList();
		Map map1 = new LinkedHashMap();
		map1.put("name", " 小明");
		map1.put("sex", "男");
		map1.put("age", "22");
		lstMaps.add(map1);

		Map map2 = new LinkedHashMap();
		map2.put("name", " 小明");
		map2.put("sex", "男");
		map2.put("age", "22");
		lstMaps.add(map2);

		session.setAttribute("lstMap", lstMaps);
	%>
	<br>

	<%-- <c:forEach items="${sessionScope.lst }" var="eachValue"
		varStatus="statu">
		<c:out value="${statu.index+1}"></c:out>
		<c:out value="${eachValue.student_code }"></c:out>
		<c:out value="${eachValue.student_name }"></c:out>
		<c:out value="${eachValue.sex }"></c:out>
		<c:out value="${eachValue.age }"></c:out>
		<c:out value="${eachValue.phone }"></c:out>
		<c:out value="${eachValue.address }"></c:out>

	</c:forEach> --%>

	<table class="table table-bordered table-hover tab">
		<thead>
			<tr>
				<th>#</th>
				<th>学号</th>
				<th>姓名</th>
				<th>性别</th>
				<th>年龄</th>
				<th>电话号码</th>
				<th>地址</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${sessionScope.lst }" var="eachValue"
				varStatus="statu">
				<tr>
					<td>${statu.index+1}</td>
					<td>${eachValue.student_code }</td>
					<td>${eachValue.student_name }</td>
					<td>${eachValue.sex }</td>
					<td>${eachValue.age }</td>
					<td>${eachValue.phone }</td>
					<td>${eachValue.address }</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>

	<c:forEach items="${sessionScope.lstMap }" var="val" varStatus="st">
	
		<c:forEach items="${val }" var="each" varStatus="st2">
			
			<c:out value="${each.key}"></c:out>
			<c:out value="${each.value}"></c:out>
		</c:forEach>
	</c:forEach>
	<br>
	//单独输出
	<c:out value="${sessionScope.lstMap[0]}" ></c:out>
	

	
</body>
</html>